<?php
/* @var $this BanggiaController */
/* @var $model Banggia */

$this->breadcrumbs=array(
	'Bảng giá'=>array('admin'),
	$model->tenbanggia,
);
?>


<script>

$(document).ready(function(){
	$('#search').keyup(function(){
		var data = $(this).val();
		$.ajax({
            url: 'SuggestPerson',
            type: 'POST',
            dataType: 'JSON',
            data: {term: data},
            success: function(result){
            //$('#price').html(result.data.gia);
            //alert(result[0].username);
            $('#table tr').each(function() {
				//alert($(this).index());
				$(this).hide();
				if($(this).index()==0)
				{
					$(this).show();
				}
				for(var i=0;i<result.length;i++)
			    if($(this).find(".username").html() == result[i].username)
			    {
					$(this).show();
				}  	    
	 		});
            }
    		});
		});
});
</script>

<br>

<div class='full-screen'>

	<h1>Xem chi tiết bảng giá <b><?php echo $model->tenbanggia; ?></b></h1>

	<div class="row">

		<div class="form">
		
		<?php $form=$this->beginWidget('CActiveForm', array(
			'id'=>'bangiadichvu-form',
			'enableAjaxValidation'=>false,
		)); ?>
		
			<?php echo $form->errorSummary($banggiadichvu); ?>
		
			<div class="row">
				<?php echo $form->labelEx($banggiadichvu,'iddichvu'); ?>
				<?php echo $form->dropDownList($banggiadichvu,'iddichvu', $listdichvu); ?>
				<?php echo $form->error($banggiadichvu,'iddichvu'); ?>
			</div>
		
			<div class="row">
				<?php echo $form->labelEx($banggiadichvu,'gia'); ?>
				<?php echo $form->textField($banggiadichvu,'gia'); ?>
				<?php echo $form->error($banggiadichvu,'gia'); ?>
			</div>
		
			<div class="row buttons">
				<?php echo CHtml::submitButton($model->isNewRecord ? 'Create' : 'Save'); ?>
			</div>
		
		<?php $this->endWidget(); ?>
		
		</div><!-- form -->	


	</div><br/>

		<div class='main-content' >
			<table id=table width='100%' style='background:white;'>
				<tr class='header-table'>
					<th width='80%'>Tên dịch vụ</th>
					<th width='10%'>Giá</th>
					<th width='10%'>Xóa</th>
				</tr>

			<?php
			foreach ($model->tbbangiadichvus as $value){
				echo "<tr class='row-table'>";
				echo "<td>".$value->tbdichvu->tendichvu. "</td>";
				echo "<td>". $value->gia. "</td>";
				echo "<td>". CHtml::link( 'Xóa', array('bangiadichvu/xoa','id'=> $value->id)). "</td>";
				echo "</tr>";
			}
			?>
			</table>
		</div>
</div>